const defaultState = {
	showGift: true,
	grab: false,
	prizeModal: false,
	payAttentionModal: false,
	phoneModal: false,
	addressModal: false,
	ruleModal: false,
	entrance:{},
	detailId:0,
	winrecord:{},
	recommendTopList:[],
	recommendInfo:[],
	ecard: {}
};

const reducer = (state = defaultState, action) =>{
	switch (action.type){
		case 'entrance':
			return { ...state,entrance:{ ...action.payload}};
		case 'openRule':
			return { ...state,ruleModal:true};
		case 'closeRule':
			return { ...state,ruleModal:false};
		case 'openAddress':
			return { ...state,addressModal:true, ...action.payload};
		case 'closeAddress':
			return { ...state,addressModal:false};
		case 'openWinPrize':
			return { ...state,prizeModal:true};
		case 'closeWinPrize':
			return { ...state,prizeModal:false};
		case 'openPhone':
			return { ...state,phoneModal:true};
		case 'closePhone':
			return { ...state,phoneModal:false};
		case 'openAttention':
			return { ...state,payAttentionModal:true};
		case 'closeAttention':
			return { ...state,payAttentionModal:false};
		case 'showGift':
			return { ...state,showGift:true};
		case 'hideGift':
			return { ...state,showGift:false};
		case 'grab':
			return { ...state,grab:true,showGift:false};
		case 'hideGrab':
			return { ...state,grab:false};
		case 'winrecord':
			return { ...state, winrecord:{...action.payload}};
		case 'recommendTop':
			return { ...state, ...action.payload};
		case 'recommendInfo':
			return { ...state, ...action.payload};
		case 'phoneNumber':
			return { ...state, ...action.payload, phoneModal: false};
		case 'ecard':
			return { ...state, ...action.payload};
		case 'detailId':
			return { ...state, ...action.payload};
		default:
			return state;
	}
};

export default reducer;
